﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title> match()方法的应用示例</title>
</head>
<body>
    <p id="demo">单击按钮显示匹配结果。</p>
    <button onclick="myFunction()">显示</button>
    <script>
        function myFunction() {
            let str = "I am a good BOY,but not boys";
            let n = str.match(/boy/gi);
            document.getElementById("demo").innerHTML = n;
        }
    </script>
</body>
</html>
